/*
 * Copyright 2005-2013 sxhuayuan.com. All rights reserved.
 */
package com.sxhuayuan.parking.compenent.shiro;

import java.io.Serializable;

/**
 * 身份信息
 * 
 * @author gaoyan
 * @version 1.0
 */
public class Principal implements Serializable {

	private static final long serialVersionUID = 5798882004228239559L;

	private AccountType type;

	/** ID */
	private Long id;

	/** 用户名 */
	private String username;

	/** 昵称 */
	private String nickname;

	/**
	 * @param id
	 *            ID
	 * @param username
	 *            用户名
	 */
	public Principal(AccountType type, Long id, String username) {
		this.type = type;
		this.id = id;
		this.username = username;
	}

	public Principal(AccountType type, Long id, String username, String nickname) {
		this.type = type;
		this.id = id;
		this.username = username;
		this.nickname = nickname;
	}

	/**
	 * 获取ID
	 * 
	 * @return ID
	 */
	public Long getId() {
		return id;
	}

	/**
	 * 设置ID
	 * 
	 * @param id
	 *            ID
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * 获取用户名
	 * 
	 * @return 用户名
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * 设置用户名
	 * 
	 * @param username
	 *            用户名
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	@Override
	public String toString() {
		return String.format("%s(%s)", username, nickname);
	}

	public AccountType getType() {
		return type;
	}

	public void setType(AccountType type) {
		this.type = type;
	}

}